#define DIR_PIN 2
#define STEP_PIN 3

int counter = 0;

void setup() {
  pinMode(DIR_PIN, OUTPUT);
  pinMode(STEP_PIN, OUTPUT);
} 

void loop(){ 
  while(counter < 100) {
    rotate(25000);
    if(counter == 0)
      delay(3000);
    rotate(-25000);
    counter++;
  }
}

void rotate(int steps){
  //rotate a specific number of microsteps (8 microsteps per step) - (negitive for reverse movement)
  //speed is any number from .01 -> 1 with 1 being fastest - Slower is stronger
  
  //min delay for bottom motor: 50us at ~11v
  //min delay for top motor: 
  
  int dir = (steps > 0)? HIGH:LOW;
  steps = abs(steps);

  digitalWrite(DIR_PIN,dir);

  float usDelay;

  for(int i=0; i < steps; i++){
    if(i < 10) {
      usDelay = (1/(.1*i)) * 70;
    }
    else {
      usDelay = 70;
    }
    digitalWrite(STEP_PIN, HIGH);
    delayMicroseconds(usDelay); 

    digitalWrite(STEP_PIN, LOW);
    delayMicroseconds(usDelay);
  }
}
